<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>javascript 阶段</title>
    <style>
        h3 {
            text-align: center;
        }
    </style>
</head>
<body>


    <script>
        function getCurrentTime() {
            var str = "";
            var dt = new Date();
            var hour = dt.getHours();
            console.log(hour);
            var min = dt.getMinutes();
            console.log(min);
            var second = dt.getSeconds();
            console.log(second);
                str +="<h3>"+hour+':'+min+':'+second+"</h3>"
            document.write(str);
        }
        getCurrentTime();
    </script>
</body>
</html>